package top.xmj.service.impl;

import org.springframework.stereotype.Service;
import top.xmj.dao.SubMessageMapper;
import top.xmj.exception.BusinessException;
import top.xmj.pojo.SubMessage;
import top.xmj.service.ISubMessageService;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 冰咖啡
 * Date:4/12/2022 下午 5:35
 * Description:
 */
@Service
public class SubMessageServiceImpl implements ISubMessageService {

    @Resource
    private SubMessageMapper subMessageMapper;

    @Override
    public List<SubMessage> getListById(String id) {
        return subMessageMapper.getListById(id);
    }

    @Override
    public int addSubMsg(SubMessage subMessage) {
        int res = subMessageMapper.insert(subMessage);
        if(res!=1){
            throw new BusinessException(505,"消息添加异常");
        }
        return res;
    }
}

